<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html >
<head>
<%@include file="/template/basic.jspf"%>
</head>
<script type="text/javascript">
function closeWin(){
	layer.confirm('是否关闭窗口？', {icon: 3}, function(index) {
    	parent.layer.close(parent.pageii);
    	return false;
	});
}

function sub(){
	var nodes  = getfunctionId();
	var data ='';
	for(var i=0;i<nodes.length;i++){
		data+=nodes[i].id+',';
	}
	$.post( rootPath +"/system/roleInfo/addRoleFunctionEntity.shtml",{data:data,roleId:"${roleId }"},function(data){
		if (data.indexOf("success")>0) {
			layer.alert('保存成功！');
			parent.grid.loadData();
        	parent.layer.close(parent.pageii);
        	return false;
		} else {
			layer.alert('保存失败！');
		}
	
	});
	
}
</script>
<body>
			<input type="hidden" id="roleId" name="sysRoleResFormMap.role_id" value="${roleId }">	
			<div  style="text-align:center;">
			 <app:tree node="list" id="funtree" width="300px;" openAll="true"  check="true" selectValues="getfunctionId" checks="${functionIds }" hideNodes="${hiddenResTree }"/>
			</div>
		
			<div class="doc-buttons" style="text-align: center;">
			<a href="javascrip:void(0)" class="btn btn-s-md btn-success btn-rounded" onclick="sub()">保存</a>
			<a href="javascrip:void(0)" class="btn btn-s-md btn-info btn-rounded" onclick="closeWin();">关闭</a>
			</div>
</body>

</html>